package com.example.productservice.dao;

import com.example.productservice.bean.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductDao {
    @Select("select * from product")
    List<Product> findAll();

    @Select("select * from product where id = #{id}")
    Product findById(Long id);

    @Insert("insert into product(name, description, price) values(#{name}, #{description}, #{price})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(Product product);
}